package com.example.sale.Service.imply;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.sale.Mapper.ProductDetailMapper;
import com.example.sale.Service.IProductDetailService;
import com.example.sale.True.ProductDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductDetailService extends ServiceImpl<ProductDetailMapper, ProductDetail> implements IProductDetailService {
    @Autowired
    private ProductDetailMapper productDetailMapper;
    @Override
    public boolean isProductDetailExists(String name, Integer id) {
        ProductDetail exist = productDetailMapper.findExist(name,id);
        return exist!=null;
    }

    @Override
    public List<ProductDetail> GetBYUserid(Integer userid) {
            QueryWrapper<ProductDetail> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("userid", userid);
            return productDetailMapper.selectList(queryWrapper);
    }
}
